/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.sql.*;

/**
 *
 * @author VICTOR
 */
public class DetalleMatricula {
    private int idDetMatricula;
    private Matricula objMatricula=new Matricula();
    private DetalleCursoDocente objDetCurDoc=new DetalleCursoDocente();
    private String inhabilitado;

    public DetalleMatricula() {
    }

    public int getIdDetMatricula() {
        return idDetMatricula;
    }

    public void setIdDetMatricula(int idDetMatricula) {
        this.idDetMatricula = idDetMatricula;
    }

    public String getInhabilitado() {
        return inhabilitado;
    }

    public void setInhabilitado(String inhabilitado) {
        this.inhabilitado = inhabilitado;
    }

    public DetalleCursoDocente getObjDetCurDoc() {
        return objDetCurDoc;
    }

    public void setObjDetCurDoc(DetalleCursoDocente objDetCurDoc) {
        this.objDetCurDoc = objDetCurDoc;
    }

    public Matricula getObjMatricula() {
        return objMatricula;
    }

    public void setObjMatricula(Matricula objMatricula) {
        this.objMatricula = objMatricula;
    }
    
     //==========================================================================
    //-----registro
    public static boolean registrarDMatricula (DetalleMatricula a)
    {
        boolean estado = false ;
        Connection conexion=null;
         try{
             conexion=ControladorBD.darConexionBD();
             CallableStatement st=conexion.prepareCall(" {CALL sp_detalle_matricula_registro"
                     +"(?,?,?,?)} ");
             st.setInt(1,a.getObjMatricula().getObjAlumno().getIdAlumno());
             st.setInt(2,a.getObjDetCurDoc().getIdDetCurso());
             st.setInt(3,a.getObjMatricula().getObjVoucher().getIdVoucher());
             st.registerOutParameter(4,java.sql.Types.VARCHAR);
             st.execute();
             
             if(!"ok".equals(st.getString(5)))
             {
               estado=true;
             }
        st.close();
        conexion.close();
             
         } catch(Exception error){
             System.out.println("Error en el metodo por: "+ error.getMessage());
                                 error.printStackTrace();
         }
        return estado;  
        
    }
}
